package config.guice;

import opensocial.data.*;
import opensocial.data.basic.*;
import opensocial.services.*;

import org.apache.shindig.social.core.config.SocialApiGuiceModule;
import org.apache.shindig.social.opensocial.oauth.OAuthDataStore;
import org.apache.shindig.social.opensocial.spi.*;
import org.apache.shindig.social.sample.oauth.*;

import com.google.inject.name.*;

public class ConfigurationModule extends SocialApiGuiceModule {
  @Override
  protected void configure() {
    super.configure();
    
    //Services
    bind(ActivityService.class).to(ActivityServiceImpl.class);
    bind(PersonService.class).to(PersonServiceImpl.class);
    bind(AppDataService.class).to(AppDataServiceImpl.class);
    
    //Database
    bind(PersonDAO.class).to(PersonDAOImpl.class);
    bind(DatabaseGateway.class).to(SQLiteDatabaseGateway.class);
    bind(String.class).annotatedWith(Names.named("connection.string")).toInstance("jdbc:sqlite:./webapps/ROOT/WEB-INF/classes/database/social.s3db");
    
    //Shindig OAuth required bindings
    bind(String.class).annotatedWith(Names.named("shindig.canonical.json.db")).toInstance("sampledata/canonicaldb.json");
    bind(OAuthDataStore.class).to(SampleOAuthDataStore.class);
    requestStaticInjection(SampleRealm.class);
  }
}
